#include "progressbar.h"
#include "ui_progressbar.h"

ProgressBar::ProgressBar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ProgressBar)
{
    ui->setupUi(this);

    timer = new QTimer(this);
    connect(timer, &QTimer::timeout, this, &ProgressBar::handle);
    timer->start(100);
}

ProgressBar::~ProgressBar()
{
    delete ui;
}

void ProgressBar::handle()
{
    int value = ui->progressBar->value();
    if (value >= 100)
    {
        timer->stop();
        return;
    }
    ui->progressBar->setValue(value + 1);
}
